package com.suxii.todomvi.data.repository

import com.suxii.todomvi.domain.model.Todo
import com.suxii.todomvi.data.local.TodoDao
import com.suxii.todomvi.domain.repository.TodoRepository
import kotlinx.coroutines.flow.Flow

class TodoRepositoryImpl(
    private val todoDao: TodoDao
): TodoRepository {
    override suspend fun insert(todo: Todo) {
        todoDao.insert(todo)
    }

    override suspend fun update(todo: Todo) {
        todoDao.update(todo)
    }

    override suspend fun delete(todo: Todo) {
        todoDao.delete(todo)
    }

    override suspend fun deleteByIds(ids: Set<Int>) {
        todoDao.deleteByIds(ids)
    }

    override fun queryAll(): Flow<List<Todo>> {
        return todoDao.queryAll()
    }
}